﻿<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@page pageEncoding="UTF-8" contentType="text/html; UTF-8" isELIgnored="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>Insert title here</title>
	<link type="text/css" rel="stylesheet" href="css/style.css">
	<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
	<script type="text/javascript">
		function update() {
			// 获取用户ID
			var userId = ${user.id};
			//alert("修改完成"); // 这应该显示正确的用户ID
			// 提交表单到更新页面
			window.location.href = '${pageContext.request.contextPath}/user/updateView?userId=' + userId;
		}
		function deleteUser(){
			var userId = ${user.id};
			window.location.href = '${pageContext.request.contextPath}/user/delete?userId=' + userId;
		}
		function updatePassword(){
			window.location.href = '${pageContext.request.contextPath}/updatePwd.jsp' ;
		}
	</script>
</head>
<body>
<c:if test="${not empty user}">
	<div class="main">
		<div class="optitle clearfix">
			<div class="title">
				<h2>用户管理&gt;&gt;</h2>
			</div>
		</div>
		<div class="content">
			<table class="box">
				<tbody>
				<tr>
					<td class="field">用户编号：</td>
					<td>${user.id}<input type="hidden" id="userId" value="${user.id}"></td>
				</tr>
				<tr>
					<td class="field">用户名：</td>
					<td>${user.username}</td>
				</tr>
				<tr>
					<td class="field">姓名：</td>
					<td>${user.name}</td>
				</tr>
				<tr>
					<td class="field">职位：</td>
					<td>${user.role}</td>
				</tr>
				</tbody>
			</table>
		</div>
		<div class="buttons">
			<input type="button" id="update" value="修改" class="input-button" onclick="update()">
			<input type="button" id="del" value="删除" class="input-button" onclick="deleteUser()">
			<%--<input type="button" id="repassword" value="重置密码" class="input-button" onclick="updatePassword()">--%>
			<input type="button" id="backButton" onclick="history.back(-1)" value="返回" class="input-button">
		</div>
	</div>
</c:if>
<script type="text/javascript" src="../js/user/view.js"></script>
</body>
</html>